package com.star.carservice.client.adapter;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

import com.squareup.picasso.Picasso;
import com.star.carservice.R;
import com.star.carserviceapi.domain.CarFeatureInfo;

import android.content.Context;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CarSeriesListAdapter extends BaseAdapter {

	private Context mContext = null;
	private CarFeatureInfo mCarFeatureInfo = null;
	private List<String> mData = null;
	private LayoutInflater mInflater = null;

	public CarSeriesListAdapter(Context context, CarFeatureInfo carFeatureInfo,
			List<String> data) {
		super();
		mContext = context;
		mCarFeatureInfo = carFeatureInfo;
		mData = data;

		mInflater = LayoutInflater.from(mContext);
	}

	@Override
	public int getCount() {
		return mData.size();
	}

	@Override
	public Object getItem(int position) {
		return mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {

			viewHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.list_item_car_series_item,
					null);

			ButterKnife.inject(viewHolder, convertView);

			convertView.setTag(viewHolder);

		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}

		viewHolder.lbl_series_name.setText(mData.get(position));

		return convertView;
	}

	class ViewHolder {
		@InjectView(R.id.lbl_series_name)
		TextView lbl_series_name;
	}
}
